﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 构造和析构
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Person p = new Person("yejing", 45);
            Console.WriteLine("{0},{1}",p.Name,p.Age);
            Console.ReadKey();
        }
    }

    internal class Person
    {
        String _name;
        int _age;

        public Person(String name,int age) 
        { 
            this._name = name;
            this._age = age;

            Console.WriteLine("调用Person类的构造函数");
        }
        ~Person(){
            

            Console.WriteLine("调用Person类的析构函数");
        }
        public string Name { get=>_name; set=>_name=value; }
        public int Age { get=>_age; set=>_age=value; }
    }
}
